ToolsRepository Class
The ToolsRepository class manages the collection of available tools, including methods for tool registration, discovery, and invocation.Constructor
configuration
(Optional[Configuration]): SDK configuration. Defaults to environment variables if not provided.
Properties
functions
Methods
register_tool(tool)
Registers a local tool (class method).
tool
(Tool): The tool instance to register.
get_tool_by_id(tool_id)
Retrieve a tool by its unique identifier.
tool_id
(str): Unique identifier of the tool.
- [
ModuleException
](/API reference/exceptions): If there’s an error accessing the tools repository.
should_sync_local_tools()
Check if local tools require synchronization with the backend.
bool
:True
if synchronization needed, otherwiseFalse
.
Usage Examples
Tool Discovery and Invocation
Custom Tool Registration
Tool Synchronization Check
Tool Class
Properties
id
name
configuration
Methods
ainvoke(agent_id, payload, **kwargs)
Asynchronously invoke the tool.
agent_id
(str): Identifier for the agent using the tool.payload
(dict): Input data for tool execution.**kwargs
: Additional parameters for the tool invocation.
ToolInvocationResult
](/API reference/types#toolinvocationresult) with execution details and success status.
Example:
invoke(agent_id, payload, **kwargs)
Synchronously invoke the tool.
ainvoke()
.
Returns: [ToolInvocationResult
](/API reference/types#toolinvocationresult) with execution details.
set_configuration(config)
Update the tool’s configuration.
config
(dict): Configuration settings for the tool.
Related Types
See [SDK Types Reference](/API reference/types) for detailed information on:- [
ToolInvocationResult
](/API reference/types#toolinvocationresult): Tool execution result details
Error Handling
Related Classes
- [
Agent
](/API reference/agents/API reference/agent): Agents that use tools for task execution - [
Configuration
](/API reference/configuration): SDK configuration
Related Modules
- [Agents Module](/API reference/agents): Agent management and tool usage
- [Tasks Module](/API reference/tasks): Task execution using tools
- [Knowledge Bases](/API reference/knowledge): Document management and search